package kr.saeildamil.androidstudy.ch19;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

public class HandlerMessageTest extends Activity {
	int mMainValue;
	TextView MainValueTv;
	TextView BackValueTv;
	BackThread mThread;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch19_threadtestt);

		MainValueTv = (TextView) findViewById(R.id.ch19_threadtest_mainvalue);
		BackValueTv = (TextView) findViewById(R.id.ch19_threadtest_backvalue);

		mThread = new BackThread(mHandler);
		mThread.setDaemon(true);
		mThread.start();
	}

	Handler mHandler = new Handler() {
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			if (msg.what == 0) {
				BackValueTv.setText("BACK VALUE : " + msg.arg1);
			}
		}// end of method handleMessage
	};
}
